package com.demo.aop.profile;

import org.springframework.aop.framework.ProxyFactory;

/**
 * 描述：执行代理，环绕通知以统计方法的执行时间
 *
 * @author lida
 * @time 2019/10/23 10:31
 */
public class ProfilingDemo {

	public static void main(String[] args) {
		ProfilingInterceptor pi = new ProfilingInterceptor();
		WorkBean target = new WorkBean();

		//代理
		ProxyFactory pf = new ProxyFactory();
		pf.setTarget(target);
		pf.addAdvice(pi);

		WorkBean proxyBean = (WorkBean) pf.getProxy();
		proxyBean.doSomeWorks(10000);
	}
}
